<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>在线考试</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var examTime=20*60;
		var useTime=0,remainTime=examTime;
		
		function showCount(){
			
			if(remainTime==0){
				document.getElementById("myForm").submit();
			}
			
			useTime+=1;
			remainTime-=1;
			
			var hourU=Math.floor(useTime/3600);
			var minuteU=Math.floor((useTime-hourU*3600)/60);
			var secondU=Math.floor(useTime-hourU*3600-minuteU*60);
			document.getElementById("useTime").innerHTML=format(hourU)+":"+format(minuteU)+":"+format(secondU);
			
			var hourR=Math.floor(remainTime/3600);
			var minuteR=Math.floor((remainTime-hourR*3600)/60);
			var secondR=Math.floor(remainTime-hourR*3600-minuteR*60);
			document.getElementById("remainTime").innerHTML=format(hourR)+":"+format(minuteR)+":"+format(secondR);
		}
		
		function format(timeNumber){
			if(timeNumber<10){
				return "0"+timeNumber;
			}else{
				return timeNumber;
			}
		}
		
		window.setInterval("showCount()", 1000);
	</script>
</head>
<body>
<div class="data_list" style="font-size:18px;" >
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/gra/paper/examLine">在线考试</a></li>
	</ul>
	<div align="center">
		<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;考试时间：<strong>20分钟</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		计时：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font id="useTime" style="font-weight: bold;"></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		剩余时间：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font id="remainTime" style="font-weight: bold;"></font></p>
		<hr/>
		<p class="examTitle">${paper.paperName}&nbsp;&nbsp;考试卷</p>
		<p class="examScoreInfo">(&nbsp;满分120&nbsp;&nbsp;单选题60分&nbsp;&nbsp;多选题60分&nbsp;)</p>
	</div>
	<div style="padding-left: 45px;">
		<form:form id="lineForm" modelAttribute="paper" action="${ctx}/gra/paper/examResult" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${paperId }"/>
		<input type="hidden" name="user.id" value="${fns:getUser()}"/>
		<strong><big>一、单选题</big></strong>(每题20分，答错不得分)<br/><br/>
		<c:forEach var="s" items="${squestionList}" varStatus="status">
			<strong>[&nbsp;${status.index+1 }&nbsp;]&nbsp;${s.subject }</strong><br/><br/>
			<label class="radio">
				<input type="radio" name="id-r-${s.id }" value="A"/>
				${s.optiona }
			</label>
			<label class="radio">
				<input type="radio" name="id-r-${s.id }" value="B"/>
				${s.optionb }
			</label>
			<label class="radio">
				<input type="radio" name="id-r-${s.id }" value="C"/>
				${s.optionc }
			</label>
			<label class="radio">
				<input type="radio" name="id-r-${s.id }" value="D"/>
				${s.optiond }
			</label>
			<br/>
		</c:forEach>
		<br/>
		<strong><big>二、多选题</big></strong>(每题30分，答错不得分)<br/><br/>
		<c:forEach var="m" items="${mquestionList}" varStatus="status">
			<strong>[&nbsp;${status.index+1 }&nbsp;]&nbsp;${m.subject }</strong><br/><br/>
			<label class="checkbox">
				<input type="checkbox" name="id-c-${m.id }" value="A"/>
				${m.optiona }
			</label>
			<label class="checkbox">
				<input type="checkbox" name="id-c-${m.id }" value="B"/>
				${m.optionb }
			</label>
			<label class="checkbox">
				<input type="checkbox" name="id-c-${m.id }" value="C"/>
				${m.optionc }
			</label>
			<label class="checkbox">
				<input type="checkbox" name="id-c-${m.id }" value="D"/>
				${m.optiond }
			</label>
			<br/>
		</c:forEach>
		<button class="btn btn-primary" type="submit">交卷</button>
		</form:form>
	</div>
</div>
</body>
</html>